<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>人才信息库</span>
      </div>

      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        v-show="showSearch"
        label-width="68px"
      >
        <el-form-item label="搜索内容" prop="searchValue">
          <el-input
            v-model="queryParams.searchValue"
            placeholder="请输入搜索内容"
            clearable
            size="small"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
          >
            搜索
          </el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">
            重置
          </el-button>
        </el-form-item>
      </el-form>

      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['recruit:recruiter:add']"
          >
            新增
          </el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['recruit:recruiter:export']"
            >导出</el-button
          >
        </el-col>
        <right-toolbar
          :showSearch.sync="showSearch"
          @queryTable="getList"
        ></right-toolbar>
      </el-row>

      <el-table v-loading="loading" :data="list" stripe>
        <el-table-column label="序号" align="center" width="55">
          <template slot-scope="scope">
            {{
              (queryParams.pageNum - 1) * queryParams.pageSize +
              scope.$index +
              1
            }}
          </template>
        </el-table-column>
        <el-table-column label="一级部门" align="center" prop="firstDept" />
        <el-table-column label="二级部门" align="center" prop="secondDept" />
        <el-table-column label="岗位" align="center" prop="post" />
        <el-table-column label="姓名" align="center" prop="name" width="80" />
        <el-table-column label="性别" align="center" prop="sex" width="55">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.recruit_user_sex"
              :value="scope.row.sex"
            />
          </template>
        </el-table-column>
        <el-table-column label="年龄" align="center" prop="age" width="55" />
        <el-table-column
          label="学历"
          align="center"
          prop="education"
          width="60"
        />
        <el-table-column
          label="联系电话"
          prop="phone"
          align="center"
          width="100"
        />
        <el-table-column label="招聘官" prop="interviewer" align="center" />
        <el-table-column
          label="沟通时间"
          prop="communicationTime"
          align="center"
          width="150"
        >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.communicationTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="是否面试" prop="isInterview" align="center">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.recruit_is_interview"
              :value="scope.row.isInterview"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="面试结果"
          prop="interviewResult"
          align="center"
          width="100"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.recruit_interview_result"
              :value="scope.row.interviewResult"
            />
          </template>
        </el-table-column>
        <el-table-column label="现任公司" prop="company1" align="center" />
        <el-table-column label="上任公司" prop="company2" align="center" />
        <el-table-column label="行业" prop="industry" align="center" />
        <el-table-column label="毕业院校" prop="college" align="center" />
        <el-table-column label="专业" prop="professional" align="center" />
        <el-table-column
          label="入库时间"
          align="center"
          prop="inputTime"
          width="150"
        >
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.inputTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column
          fixed="right"
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
          width="120"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              v-hasPermi="['recruit:recruiter:edit']"
              @click="handleUpdate(scope.row)"
            >
              人才信息
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>

    <!-- 添加或修改【请功能名称】对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-card shadow="never">
          <div slot="header" class="clearfix">
            <span>招聘岗位</span>
          </div>
          <el-row>
            <el-col :span="6">
              <el-form-item label="入库时间" prop="inputTime">
                <el-date-picker
                  v-model="form.inputTime"
                  type="datetime"
                  style="width: 100%"
                  disabled
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="一级部门" prop="firstDept">
                <el-input v-model="form.firstDept" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="二级部门" prop="secondDept">
                <el-input v-model="form.secondDept" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="岗位" prop="post">
                <el-input v-model="form.post" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>

        <el-card shadow="never">
          <div slot="header" class="clearfix">
            <span style="">人员信息</span>
          </div>
          <el-row>
            <el-col :span="6">
              <el-form-item label="姓名" prop="name">
                <el-input v-model="form.name" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="性别" prop="sex">
                <el-radio-group v-model="form.sex">
                  <el-radio
                    v-for="dict in dict.type.recruit_user_sex"
                    :key="dict.value"
                    :label="dict.value"
                  >
                    {{ dict.label }}
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="年龄" prop="age">
                <el-input-number
                  v-model="form.age"
                  :min="1"
                  :max="100"
                  style="width: 100%"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="学历" prop="education">
                <el-input v-model="form.education" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="6">
              <el-form-item label="毕业院校" prop="college">
                <el-input v-model="form.college" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="专业" prop="professional">
                <el-input v-model="form.professional" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="联系电话" prop="phone">
                <el-input v-model="form.phone" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="邮箱" prop="email">
                <el-input v-model="form.email" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="6">
              <el-form-item label="行业" prop="industry">
                <el-input
                  v-model="form.industry"
                  placeholder="耳机、手机、品牌商、方案商、IOT、大型MES制造企业"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="耳机行业" prop="isHeadsetIndustry">
                <el-radio-group v-model="form.isHeadsetIndustry">
                  <el-radio
                    v-for="dict in dict.type.recruit_headset_industry"
                    :key="dict.value"
                    :label="dict.value"
                  >
                    {{ dict.label }}
                  </el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="现任公司" prop="company1">
                <el-input v-model="form.company1" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="上任公司" prop="company2">
                <el-input v-model="form.company2" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="6">
              <el-form-item label="意愿度" prop="aspiration">
                <el-input
                  v-model="form.aspiration"
                  placeholder="不考虑、一般、良好、强烈"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="人才来源" prop="talentSource">
                <el-input
                  v-model="form.talentSource"
                  placeholder="前程无忧、猎聘网、人才热线、卓博、内部推荐、猎头、其它"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="匹配度" prop="matching">
                <el-input
                  v-model="form.matching"
                  placeholder="一般、较好、优秀"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="国籍" prop="nationality">
                <el-input v-model="form.nationality" />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="6">
              <el-form-item label="目前月薪" prop="currentSalary">
                <el-input
                  v-model="form.currentSalary"
                  placeholder="固定薪资+提成+其他收入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="目前年薪" prop="currentAnnualSalary">
                <el-input
                  v-model="form.currentAnnualSalary"
                  placeholder="固定薪资+其他激励薪资"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="期望月薪" prop="expectedSalary">
                <el-input
                  v-model="form.expectedSalary"
                  placeholder="固定薪资+提成+其他收入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="期望年薪" prop="expectedAnnualSalary">
                <el-input
                  v-model="form.expectedAnnualSalary"
                  placeholder="固定薪资+其他激励薪资"
                />
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="18">
              <el-form-item label="服务客户" prop="customerService">
                <el-input
                  type="textarea"
                  v-model="form.customerService"
                  :rows="3"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </el-card>
      </el-form>
      <div class="dialog-footer my-text-align-center">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>

      <el-divider v-if="form.recruitId" />

      <!-- 文件上传 -->
      <el-card
        shadow="never"
        v-if="form.recruitId"
        v-hasPermi="['recruit:recruiter:upload']"
      >
        <div slot="header" class="clearfix">
          <span>资料上传</span>

          <el-tooltip placement="top">
            <div slot="content">
              ① 上传文件且不超过100M<br />
              ② 上传文件名不能带有特殊符号：& ？ = / 等<br />
              ③ 上传文件名注意规范：年月日+姓名+岗位 等<br />
              ④ 在线文件预览功能使用的是 kkFileView 插件<br />
              ⑤ 在线文件预览访问不了，那就是 kkFileView 服务没有启动<br />
            </div>
            <el-button
              type="text"
              icon="el-icon-warning-outline"
              style="color: indianred; float: right; padding: 3px 0"
            >
              注意事项
            </el-button>
          </el-tooltip>
        </div>

        <el-row>
          <el-col :span="8">
            <el-upload
              class="upload-demo"
              drag
              :show-file-list="false"
              :headers="upload.headers"
              :action="upload.url + form.recruitId"
              :on-success="handleUploadSuccess"
              multiple
            >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                将文件拖到此处，或<em>点击上传</em>
              </div>
              <div class="el-upload__tip my-text-align-center" slot="tip">
                上传文件，且不超过100M
              </div>
            </el-upload>
          </el-col>

          <el-col :span="16">
            <el-table :data="fileList" stripe class="ml10 mr10">
              <el-table-column align="center" prop="fileName" label="文件名" />
              <el-table-column align="center" prop="type" label="文件类型" />
              <el-table-column align="center" prop="size" label="大小">
                <template slot-scope="scope">
                  {{ scope.row.size + 'KB' }}
                </template>
              </el-table-column>
              <el-table-column align="center" prop="createBy" label="操作人" />
              <el-table-column
                fixed="right"
                label="操作"
                align="center"
                class-name="small-padding fixed-width"
                width="170"
              >
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-view"
                    v-hasPermi="['recruit:recruiter:view']"
                    @click="handleFileView(scope.row)"
                  >
                    预览
                  </el-button>
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-download"
                    @click="handleFileDownload(scope.row)"
                  >
                    下载
                  </el-button>
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-delete"
                    v-hasPermi="['recruit:recruiter:remove']"
                    @click="handleFileRemove(scope.row)"
                  >
                    移除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-col>
        </el-row>
      </el-card>

      <el-divider v-if="form.recruitId" />

      <div class="dialog-footer my-text-align-right">
        <el-button
          type="primary"
          plain
          v-hasPermi="['recruit:recruiter:add']"
          @click="handleAddResult(form)"
        >
          新增面试结果信息
        </el-button>
      </div>

      <el-timeline>
        <el-timeline-item
          v-for="(item, index) in resultList"
          :key="index"
          :timestamp="parseTime(item.communicationTime)"
          placement="top"
        >
          <el-card>
            <div slot="header" class="clearfix">
              <span style="font-size: 16px; font-weight: bold">
                面试结果信息
              </span>
              <el-button
                style="float: right; padding: 3px 0"
                type="text"
                v-hasPermi="['recruit:recruiter:edit']"
                @click="handleEditResult(item)"
              >
                更新信息
              </el-button>
            </div>
            <el-descriptions :column="4">
              <el-descriptions-item label="招聘官">
                {{ item.interviewer }}
              </el-descriptions-item>
              <el-descriptions-item label="沟通时间" :span="3">
                {{ parseTime(item.communicationTime) }}
              </el-descriptions-item>
              <el-descriptions-item label="沟通结果" :span="4">
                {{ item.communicationResult }}
              </el-descriptions-item>
              <el-descriptions-item label="是否面试" :span="4">
                <dict-tag
                  :options="dict.type.recruit_is_interview"
                  :value="item.isInterview"
                />
              </el-descriptions-item>
              <el-descriptions-item label="面试结果" :span="4">
                <dict-tag
                  :options="dict.type.recruit_interview_result"
                  :value="item.interviewResult"
                />
              </el-descriptions-item>
              <el-descriptions-item label="面试评价" :span="4">
                {{ item.interviewAppraisal }}
              </el-descriptions-item>
            </el-descriptions>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </el-dialog>

    <!-- 添加或修改【面试结果信息】对话框 -->
    <el-dialog
      :title="titleResult"
      :visible.sync="openResult"
      width="650px"
      append-to-body
    >
      <el-form
        ref="formResult"
        :model="formResult"
        :rules="rulesResult"
        label-width="80px"
      >
        <el-card shadow="never">
          <div slot="header" class="clearfix">
            <span>面试情况</span>
          </div>
          <div>
            <el-row>
              <el-col :span="12">
                <el-form-item label="招聘官" prop="interviewer">
                  <el-input v-model="formResult.interviewer" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="沟通时间" prop="communicationTime">
                  <el-date-picker
                    v-model="formResult.communicationTime"
                    type="date"
                    placeholder="选择沟通时间"
                    style="width: 100%"
                  />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="24">
                <el-form-item label="沟通结果" prop="communicationResult">
                  <el-input
                    type="textarea"
                    v-model="formResult.communicationResult"
                    :rows="3"
                  />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="24">
                <el-form-item label="是否面试" prop="isInterview">
                  <el-radio-group
                    v-model="formResult.isInterview"
                    @change="handleChangeInterviewResult"
                  >
                    <el-radio
                      v-for="dict in dict.type.recruit_is_interview"
                      :key="dict.value"
                      :label="dict.value"
                    >
                      {{ dict.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row v-if="isInterview == '1'">
              <el-col :span="24">
                <el-form-item label="面试结果" prop="interviewResult">
                  <el-radio-group v-model="formResult.interviewResult">
                    <el-radio
                      v-for="dict in dict.type.recruit_interview_result"
                      :key="dict.value"
                      :label="dict.value"
                    >
                      {{ dict.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row v-if="isInterview == '1'">
              <el-col :span="24">
                <el-form-item label="面试评价" prop="interviewAppraisal">
                  <el-input
                    type="textarea"
                    v-model="formResult.interviewAppraisal"
                    :rows="3"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </el-card>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFormResult">确 定</el-button>
        <el-button @click="cancelResult">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  list,
  getRecruiter,
  getRecruiterResult,
  add,
  addResult,
  update,
  updateResult,
  fileList,
  viewFile,
  delFile
} from '@/api/recruit/recruiter'
import { getToken } from '@/utils/auth'

export default {
  name: 'Recruiter',
  dicts: [
    'recruit_user_sex',
    'recruit_headset_industry',
    'recruit_is_interview',
    'recruit_interview_result'
  ],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      list: [],
      // 弹出层标题
      title: '',
      // 弹出层标题
      titleResult: '',
      // 是否显示弹出层
      open: false,
      // 是否显示弹出层
      openResult: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        searchValue: ''
      },
      // 表单参数
      form: {},
      // 表单参数
      formResult: {},
      // 面试记录
      resultList: [],
      // 是否面试
      isInterview: '0',
      // 表单校验
      rules: {
        name: [{ required: true, message: '姓名不能为空', trigger: 'blur' }]
      },
      rulesResult: {
        interviewer: [
          { required: true, message: '招聘官不能为空', trigger: 'blur' }
        ],
        communicationTime: [
          {
            type: 'date',
            required: true,
            message: '沟通时间不能为空',
            trigger: 'change'
          }
        ]
      },
      // 上传
      upload: {
        // 设置上传的请求头部
        headers: { Authorization: 'Bearer ' + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + '/recruit/recruiter/upload/'
      },
      // 文件列表
      fileList: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询岗位列表 */
    getList() {
      this.loading = true
      list(this.queryParams).then((response) => {
        this.list = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    /** 取消按钮 */
    cancel() {
      this.open = false
      this.reset()
    },
    /** 取消按钮 */
    cancelResult() {
      this.openResult = false
      this.resetResult()
    },
    /** 表单重置 */
    reset() {
      this.form = {}
      this.resetForm('form')
    },
    /** 表单重置 */
    resetResult() {
      this.formResult = {}
      this.resetForm('formResult')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      // 初始化值
      this.form = {
        inputTime: new Date(),
        sex: '1',
        isHeadsetIndustry: '0'
      }
      this.resultList = []
      this.fileList = []
      this.title = '添加人才信息'
      this.open = true
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      getRecruiter(row.recruitId)
        .then((response) => {
          this.form = response.data
          this.title = '人才信息'
          if (this.form.resultList) {
            this.resultList = this.form.resultList
          }

          this.open = true
        })
        .then(() => {
          // 获取文件列表
          fileList(row.recruitId).then((response) => {
            this.fileList = response.data
          })
        })
    },
    /** 提交按钮 */
    submitForm: function () {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          if (this.form.recruitId != null) {
            update(this.form).then((response) => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            add(this.form).then((response) => {
              this.$modal.msgSuccess('新增成功')
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 是否面试 显示/隐藏 */
    handleChangeInterviewResult(value) {
      this.isInterview = value
      // 面试否，清空面试结果、面试评价
      if (value === '0') {
        this.formResult.interviewResult = ''
        this.formResult.interviewAppraisal = ''
      }
    },
    /** 新增面试结果 */
    handleAddResult(val) {
      this.resetResult()
      // 默认面试 否
      this.isInterview = '0'
      // 初始化赋值
      this.formResult = { recruitId: val.recruitId, isInterview: '0' }
      this.titleResult = '添加面试结果信息'
      this.openResult = true
    },
    /** 更新面试结果 */
    handleEditResult(val) {
      this.resetResult()
      getRecruiterResult(val.recruitResultId).then((response) => {
        this.formResult = response.data
        this.formResult.communicationTime = new Date(
          this.formResult.communicationTime
        )
        this.isInterview = this.formResult.isInterview
        this.titleResult = '更新面试结果信息'
        this.openResult = true
      })
    },
    /** 提交按钮 */
    submitFormResult: function () {
      this.$refs['formResult'].validate((valid) => {
        if (valid) {
          if (this.formResult.recruitResultId != null) {
            updateResult(this.formResult)
              .then((response) => {
                this.$modal.msgSuccess('修改成功')
                this.openResult = false
              })
              .then(() => {
                getRecruiter(this.formResult.recruitId).then((response) => {
                  this.form = response.data
                  if (this.form.resultList) {
                    this.resultList = this.form.resultList
                  }
                  this.open = true
                })
              })
          } else {
            addResult(this.formResult)
              .then((response) => {
                this.$modal.msgSuccess('新增成功')
                this.openResult = false
              })
              .then(() => {
                getRecruiter(this.formResult.recruitId).then((response) => {
                  this.form = response.data
                  if (this.form.resultList) {
                    this.resultList = this.form.resultList
                  }
                  this.open = true
                })
              })
          }
        }
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        'recruit/recruiter/export',
        {
          ...this.queryParams
        },
        `人才库数据信息${new Date().getTime()}.xlsx`
      )
    },
    /** 文件上传成功 */
    handleUploadSuccess(res, file) {
      if (res.code === 200) {
        this.$message.success('上传成功')
        this.getFileList(res.data.recruitId) //刷新页面
      } else {
        this.$message.error('文件: ' + file.name + ',' + res.msg)
      }
    },
    /** 文件预览 */
    handleFileView(row) {
      viewFile(row.url).then((response) => {
        var fileUrl = response.data //要预览文件的访问地址
        let Base64 = require('js-base64').Base64
        // 这里就是 kkfileview 那个网址
        let url =
          'http://172.16.6.47:8012/onlinePreview?url=' +
          encodeURIComponent(Base64.encode(fileUrl))
        window.open(url)
      })
    },
    /** 文件下载 */
    handleFileDownload(row) {
      window.location.href =
        process.env.VUE_APP_BASE_API +
        '/recruit/recruiter/download/resource?resource=' +
        row.url
    },
    /** 文件移除 */
    handleFileRemove(row) {
      const recruitFileId = row.recruitFileId
      this.$modal
        .confirm('是否确认删除文件名为"' + row.fileName + '"的文件？')
        .then(function () {
          return delFile(recruitFileId)
        })
        .then(() => {
          this.getFileList(row.recruitId) //刷新页面
          this.$modal.msgSuccess('删除成功')
        })
        .catch(() => {})
    },
    /** 文件列表 */
    getFileList(recruitId) {
      fileList(recruitId).then((response) => {
        this.fileList = response.data
      })
    }
  }
}
</script>
<style>
.el-card {
  margin-bottom: 10px;
}
.el-upload {
  width: 100%;
}
.el-upload-dragger {
  width: 100%;
}
.my-text-align-right {
  text-align: right;
}
.my-text-align-center {
  text-align: center;
}
.preview {
  width: 87%;
  height: 500px;
  padding: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  background-color: #e9e9eb;
}
</style>
